<script lang="ts" setup>
import mitter from '../../util/mitter'

defineOptions({
  name: 'SInput',
})

defineProps<{ modelValue: string }>()

const emit = defineEmits<{
  (e: 'update:model-value', value: string): void
}>()

const onInput = (e: Event) => {
  emit('update:model-value', (e.target as HTMLInputElement).value)
  mitter.emit('validator')
}
</script>

<template>
  <div>
    <input class="S-input" :value="modelValue" @input="onInput" type="text" />
  </div>
</template>
